/**
 * Copyright (C), 2001-2031, www.bosssof.com.cn
 * FileName: Node.java
 * Author: chen
 * Date: 2024/6/2 12:58
 * Description:
 * <p>
 * History:
 * Date          Author   Version  Desc
 * 2024-01-01    bosssoft  1.0.0   initialize this file
 */
package com.bosssoft.g1.entity;

import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.Setter;

import java.util.ArrayList;
import java.util.List;
/**
 * @className: Node
 * @description: 定义树节点
 * @author: chen
 * @date: 2024/6/2 12:58
 * @since 1.0
 **/
@AllArgsConstructor
@ApiModel(value = "角色对应的资源树节点")
@Getter
@Setter
public class Node {

    private Long id;
    private String name;
    private byte resourceType;
    private boolean flag;
    private List<Node> children;

    // 构造方法
    public Node(Long id, String name,Byte resourceType,boolean flag) {
        this.id = id;
        this.name = name;
        this.resourceType = resourceType;
        this.flag = flag;
        this.children = new ArrayList<>();
    }

    // 仅用于 MyBatis 的构造方法
    public Node(Long id, String name) {
        this.id = id;
        this.name = name;
        this.children = new ArrayList<>();
    }


    // 添加子节点的方法
    public void addChild(Node child) {
        this.children.add(child);
    }

}